package com.zoroki.hmusic.es;

import com.zoroki.hmusic.entity.Playlist;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.elasticsearch.annotations.Highlight;
import org.springframework.data.elasticsearch.annotations.HighlightField;
import org.springframework.data.elasticsearch.core.SearchHits;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;

@Configuration
public interface EsPlaylistRepository extends ElasticsearchRepository<Playlist,String> {
    @Highlight(fields = {
            @HighlightField(name = "name"),
            @HighlightField(name = "remark"),
    })
    SearchHits<Playlist> findPlaylistByNameOrRemark(String name, String remark);

    @Highlight(fields = {
            @HighlightField(name = "name"),
            @HighlightField(name = "remark"),
    })
    Page<Playlist> findPlaylistsByNameOrRemark(String name, String remark, Pageable pageable);

}
